/**
 * UserMessage 业务逻辑实现类
 * @author yanwl
 * @date 2014-09-12
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.UserMessage;
import com.chnbst.bstyun.service.UserMessageService;

@Transactional
@Service
public class UserMessageServiceImpl extends BaseService implements UserMessageService {
	
	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(UserMessageServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.UserMessageMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteUserMessage(Integer userMessageId) {
		return DaoHelper.delete(nameSpace, "deleteUserMessage", userMessageId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertUserMessage(UserMessage userMessage) {
		return DaoHelper.insert(nameSpace, "insertUserMessage", userMessage);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateUserMessage(UserMessage userMessage) {
		return DaoHelper.update(nameSpace, "updateUserMessage", userMessage);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public UserMessage selectUserMessageByUserMessageId(Integer userMessageId) {
		return (UserMessage)DaoHelper.query(nameSpace, "selectUserMessageByUserMessageId", userMessageId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<UserMessage> selectUserMessages() {
		return (List<UserMessage>)DaoHelper.list(nameSpace, "selectUserMessages", null);
	}
}
